<?php namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
use Watson\Validating\ValidatingTrait;

/**
 * 荣誉
 * Class Award
 *
 * @package App\Models
 * @property int $id
 * @property string $name 名称
 * @property string $icon 图片
 * @mixin \Eloquent
 */
class Honor extends Model
{
    use ValidatingTrait;
    use SoftDeletes;

    protected $table = 'honors';

    protected $dates = ['deleted_at'];

    protected $fillable = ['name'];

    public $timestamps = false;

    protected $rules = [
        'name' => 'required'
    ];

    protected $validationMessages = [
        'name.required' => '名称必填',
    ];

    //调取荣誉名称
    public function getHonorName($honorId)
    {
        return Honor::withTrashed()->find($honorId)->name;
    }
}